package work.algorithm.binary;

import java.util.Arrays;
import java.util.List;

public class BinarySearch01 {

    public static void main(String[] args) {
        Integer[] nums = {-1,0,3,5,9,12};

        Integer aaa = 9 ;

        // 1. 转成list 使用indexOf
        List<Integer> list = Arrays.asList(nums);
        int index = list.indexOf(aaa);
        System.out.println(index);

        // 2. 借助Arrays类 binarySearch二分查找
        int index1 = Arrays.binarySearch(nums,aaa);
        System.out.println(index1);

        Arrays.sort(nums);


    }

}
